/*
 * Copyright 2025 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mx.ymate.security.base.model;

import net.ymate.platform.core.beans.annotation.PropertyState;
import net.ymate.platform.core.persistence.IShardingable;
import net.ymate.platform.core.persistence.annotation.*;
import net.ymate.platform.persistence.jdbc.IDatabase;
import net.ymate.platform.persistence.jdbc.IDatabaseConnectionHolder;
import net.ymate.platform.persistence.jdbc.query.AbstractFieldConditionBuilder;
import net.ymate.platform.persistence.jdbc.query.FieldCondition;
import net.ymate.platform.persistence.jdbc.query.Query;
import net.ymate.platform.persistence.jdbc.support.BaseEntity;

/**
 * SecurityMenu generated By EntityMojo on 2025/04/24 14:39:27
 *
 * @author YMP (https://www.ymate.net/)
 */
@Entity(SecurityMenu.TABLE_NAME)
@Comment("菜单表")
public class SecurityMenu extends BaseEntity<SecurityMenu, String> {

    private static final long serialVersionUID = 1L;

    @Id
    @Property(name = FIELDS.ID, nullable = false, length = 32)
    @Comment("id")
    @PropertyState(propertyName = FIELDS.ID)
    private String id;

    
    @Property(name = FIELDS.CLIENT, nullable = false, length = 100)
    @Default("default")
    @Comment("客户端")
    @PropertyState(propertyName = FIELDS.CLIENT)
    private String client;

    
    @Property(name = FIELDS.TYPE, nullable = false, length = 5)
    @Default("0")
    @Comment("菜单类型;0默认 1公开 2拥有者可看")
    @PropertyState(propertyName = FIELDS.TYPE)
    private Integer type;

    
    @Property(name = FIELDS.PARENT_ID, nullable = false, length = 32)
    @Comment("父id")
    @PropertyState(propertyName = FIELDS.PARENT_ID)
    private String parentId;

    
    @Property(name = FIELDS.NAME, nullable = false, length = 100)
    @Comment("菜单名称")
    @PropertyState(propertyName = FIELDS.NAME)
    private String name;

    
    @Property(name = FIELDS.I18N_KEY, length = 100)
    @Comment("i18nkey")
    @PropertyState(propertyName = FIELDS.I18N_KEY)
    private String i18nKey;

    
    @Property(name = FIELDS.ICON, length = 255)
    @Comment("图标")
    @PropertyState(propertyName = FIELDS.ICON)
    private String icon;

    
    @Property(name = FIELDS.PATH, length = 255)
    @Comment("路径")
    @PropertyState(propertyName = FIELDS.PATH)
    private String path;

    
    @Property(name = FIELDS.URL, length = 16383)
    @Comment("地址")
    @PropertyState(propertyName = FIELDS.URL)
    private String url;

    
    @Property(name = FIELDS.SORT, nullable = false, length = 10)
    @Default("0")
    @Comment("排序")
    @PropertyState(propertyName = FIELDS.SORT)
    private Integer sort;

    
    @Property(name = FIELDS.HIDE_STATUS, nullable = false, length = 5)
    @Default("0")
    @Comment("是否隐藏 0否 1是")
    @PropertyState(propertyName = FIELDS.HIDE_STATUS)
    private Integer hideStatus;

    
    @Property(name = FIELDS.PERMISSION, length = 255)
    @Comment("权限码")
    @PropertyState(propertyName = FIELDS.PERMISSION)
    private String permission;

    
    @Property(name = FIELDS.CREATE_TIME, nullable = false, length = 19)
    @Default("0")
    @Comment("创建时间")
    @PropertyState(propertyName = FIELDS.CREATE_TIME)
    private Long createTime;

    
    @Property(name = FIELDS.CREATE_USER, nullable = false, length = 32)
    @Comment("创建人")
    @PropertyState(propertyName = FIELDS.CREATE_USER)
    private String createUser;

    
    @Property(name = FIELDS.LAST_MODIFY_TIME, nullable = false, length = 19)
    @Default("0")
    @Comment("最后修改时间")
    @PropertyState(propertyName = FIELDS.LAST_MODIFY_TIME)
    private Long lastModifyTime;

    
    @Property(name = FIELDS.LAST_MODIFY_USER, nullable = false, length = 32)
    @Comment("最后修改人")
    @PropertyState(propertyName = FIELDS.LAST_MODIFY_USER)
    private String lastModifyUser;


    public SecurityMenu() {
    }

    public SecurityMenu(IDatabase dbOwner) {
        super(dbOwner);
    }

    public SecurityMenu(String id, String client, Integer type, String parentId, String name, Integer sort, Integer hideStatus, Long createTime, String createUser, Long lastModifyTime, String lastModifyUser) {
        this.id = id;
        this.client = client;
        this.type = type;
        this.parentId = parentId;
        this.name = name;
        this.sort = sort;
        this.hideStatus = hideStatus;
        this.createTime = createTime;
        this.createUser = createUser;
        this.lastModifyTime = lastModifyTime;
        this.lastModifyUser = lastModifyUser;
    }

        public SecurityMenu(IDatabase dbOwner, String id, String client, Integer type, String parentId, String name, Integer sort, Integer hideStatus, Long createTime, String createUser, Long lastModifyTime, String lastModifyUser) {
            super(dbOwner);
            this.id = id;
            this.client = client;
            this.type = type;
            this.parentId = parentId;
            this.name = name;
            this.sort = sort;
            this.hideStatus = hideStatus;
            this.createTime = createTime;
            this.createUser = createUser;
            this.lastModifyTime = lastModifyTime;
            this.lastModifyUser = lastModifyUser;
        }

    public SecurityMenu(String id, String client, Integer type, String parentId, String name, String i18nKey, String icon, String path, String url, Integer sort, Integer hideStatus, String permission, Long createTime, String createUser, Long lastModifyTime, String lastModifyUser) {
        this.id = id;
        this.client = client;
        this.type = type;
        this.parentId = parentId;
        this.name = name;
        this.i18nKey = i18nKey;
        this.icon = icon;
        this.path = path;
        this.url = url;
        this.sort = sort;
        this.hideStatus = hideStatus;
        this.permission = permission;
        this.createTime = createTime;
        this.createUser = createUser;
        this.lastModifyTime = lastModifyTime;
        this.lastModifyUser = lastModifyUser;
    }

    public SecurityMenu(IDatabase dbOwner, String id, String client, Integer type, String parentId, String name, String i18nKey, String icon, String path, String url, Integer sort, Integer hideStatus, String permission, Long createTime, String createUser, Long lastModifyTime, String lastModifyUser) {
        super(dbOwner);
        this.id = id;
        this.client = client;
        this.type = type;
        this.parentId = parentId;
        this.name = name;
        this.i18nKey = i18nKey;
        this.icon = icon;
        this.path = path;
        this.url = url;
        this.sort = sort;
        this.hideStatus = hideStatus;
        this.permission = permission;
        this.createTime = createTime;
        this.createUser = createUser;
        this.lastModifyTime = lastModifyTime;
        this.lastModifyUser = lastModifyUser;
    }

    @Override
    public String getId() {
        return id;
    }

    @Override
    public void setId(String id) {
        this.id = id;
    }

    public String getClient() {
        return client;
    }

    public void setClient(String client) {
        this.client = client;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getI18nKey() {
        return i18nKey;
    }

    public void setI18nKey(String i18nKey) {
        this.i18nKey = i18nKey;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Integer getHideStatus() {
        return hideStatus;
    }

    public void setHideStatus(Integer hideStatus) {
        this.hideStatus = hideStatus;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Long getLastModifyTime() {
        return lastModifyTime;
    }

    public void setLastModifyTime(Long lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    public String getLastModifyUser() {
        return lastModifyUser;
    }

    public void setLastModifyUser(String lastModifyUser) {
        this.lastModifyUser = lastModifyUser;
    }


    public Builder bind() {
        return new Builder(this);
    }

    public static Builder builder() {
        return new Builder();
    }

        public static Builder builder(IDatabase dbOwner) {
            return new Builder(dbOwner);
        }

    public static class Builder {

        private final SecurityMenu targetEntity;

        public Builder() {
            targetEntity = new SecurityMenu();
        }

        public Builder(IDatabase dbOwner) {
            targetEntity = new SecurityMenu(dbOwner);
        }

        public Builder(SecurityMenu targetEntity) {
            this.targetEntity = targetEntity;
        }

        public SecurityMenu build() {
            return targetEntity;
        }

        public IDatabaseConnectionHolder connectionHolder() {
            return targetEntity.getConnectionHolder();
        }

        public Builder connectionHolder(IDatabaseConnectionHolder connectionHolder) {
            targetEntity.setConnectionHolder(connectionHolder);
            return this;
        }

        public IDatabase dbOwner() {
            return targetEntity.getDbOwner();
        }

        public Builder dbOwner(IDatabase dbOwner) {
            targetEntity.setDbOwner(dbOwner);
            return this;
        }

        public String dataSourceName() {
            return targetEntity.getDataSourceName();
        }

        public Builder dataSourceName(String dataSourceName) {
            targetEntity.setDataSourceName(dataSourceName);
            return this;
        }

        public IShardingable shardingable() {
            return targetEntity.getShardingable();
        }

        public Builder shardingable(IShardingable shardingable) {
            targetEntity.setShardingable(shardingable);
            return this;
        }


        public String id() {
            return targetEntity.getId();
        }

        public Builder id(String id) {
            targetEntity.setId(id);
            return this;
        }

        public String client() {
            return targetEntity.getClient();
        }

        public Builder client(String client) {
            targetEntity.setClient(client);
            return this;
        }

        public Integer type() {
            return targetEntity.getType();
        }

        public Builder type(Integer type) {
            targetEntity.setType(type);
            return this;
        }

        public String parentId() {
            return targetEntity.getParentId();
        }

        public Builder parentId(String parentId) {
            targetEntity.setParentId(parentId);
            return this;
        }

        public String name() {
            return targetEntity.getName();
        }

        public Builder name(String name) {
            targetEntity.setName(name);
            return this;
        }

        public String i18nKey() {
            return targetEntity.getI18nKey();
        }

        public Builder i18nKey(String i18nKey) {
            targetEntity.setI18nKey(i18nKey);
            return this;
        }

        public String icon() {
            return targetEntity.getIcon();
        }

        public Builder icon(String icon) {
            targetEntity.setIcon(icon);
            return this;
        }

        public String path() {
            return targetEntity.getPath();
        }

        public Builder path(String path) {
            targetEntity.setPath(path);
            return this;
        }

        public String url() {
            return targetEntity.getUrl();
        }

        public Builder url(String url) {
            targetEntity.setUrl(url);
            return this;
        }

        public Integer sort() {
            return targetEntity.getSort();
        }

        public Builder sort(Integer sort) {
            targetEntity.setSort(sort);
            return this;
        }

        public Integer hideStatus() {
            return targetEntity.getHideStatus();
        }

        public Builder hideStatus(Integer hideStatus) {
            targetEntity.setHideStatus(hideStatus);
            return this;
        }

        public String permission() {
            return targetEntity.getPermission();
        }

        public Builder permission(String permission) {
            targetEntity.setPermission(permission);
            return this;
        }

        public Long createTime() {
            return targetEntity.getCreateTime();
        }

        public Builder createTime(Long createTime) {
            targetEntity.setCreateTime(createTime);
            return this;
        }

        public String createUser() {
            return targetEntity.getCreateUser();
        }

        public Builder createUser(String createUser) {
            targetEntity.setCreateUser(createUser);
            return this;
        }

        public Long lastModifyTime() {
            return targetEntity.getLastModifyTime();
        }

        public Builder lastModifyTime(Long lastModifyTime) {
            targetEntity.setLastModifyTime(lastModifyTime);
            return this;
        }

        public String lastModifyUser() {
            return targetEntity.getLastModifyUser();
        }

        public Builder lastModifyUser(String lastModifyUser) {
            targetEntity.setLastModifyUser(lastModifyUser);
            return this;
        }
    }

    public interface FIELDS {
        String ID = "id";
        String CLIENT = "client";
        String TYPE = "type";
        String PARENT_ID = "parent_id";
        String NAME = "name";
        String I18N_KEY = "i18n_key";
        String ICON = "icon";
        String PATH = "path";
        String URL = "url";
        String SORT = "sort";
        String HIDE_STATUS = "hide_status";
        String PERMISSION = "permission";
        String CREATE_TIME = "create_time";
        String CREATE_USER = "create_user";
        String LAST_MODIFY_TIME = "last_modify_time";
        String LAST_MODIFY_USER = "last_modify_user";
    }

    public static final String TABLE_NAME = "security_menu";

    public static FieldConditionBuilder conditionBuilder() {
        return new FieldConditionBuilder();
    }

    public static FieldConditionBuilder conditionBuilder(String prefix) {
        return new FieldConditionBuilder(prefix);
    }

    public static FieldConditionBuilder conditionBuilder(Query<?> query) {
        return conditionBuilder(query, null);
    }

    public static FieldConditionBuilder conditionBuilder(Query<?> query, String prefix) {
        return new FieldConditionBuilder(query.owner(), query.dataSourceName(), prefix);
    }

    public static FieldConditionBuilder conditionBuilder(SecurityMenu entity) {
        return conditionBuilder(entity, null);
    }

    public static FieldConditionBuilder conditionBuilder(SecurityMenu entity, String prefix) {
        return new FieldConditionBuilder(entity.doGetSafeOwner(), entity.getDataSourceName(), prefix);
    }

    public static FieldConditionBuilder conditionBuilder(IDatabase owner, String prefix) {
        return new FieldConditionBuilder(owner, prefix);
    }

    public static FieldConditionBuilder conditionBuilder(IDatabase owner, String dataSourceName, String prefix) {
        return new FieldConditionBuilder(owner, dataSourceName, prefix);
    }

    public static class FieldConditionBuilder extends AbstractFieldConditionBuilder {

        public FieldConditionBuilder() {
            super(null, null, null);
        }

        public FieldConditionBuilder(String prefix) {
            super(null, null, prefix);
        }

        public FieldConditionBuilder(Query<?> query) {
            super(query.owner(), null, null);
        }

        public FieldConditionBuilder(Query<?> query, String prefix) {
            super(query.owner(), query.dataSourceName(), prefix);
        }

        public FieldConditionBuilder(IDatabase owner) {
            super(owner, null, null);
        }

        public FieldConditionBuilder(IDatabase owner, String prefix) {
            super(owner, null, prefix);
        }

        public FieldConditionBuilder(IDatabase owner, String dataSourceName, String prefix) {
            super(owner, dataSourceName, prefix);
        }

        public FieldCondition id() {
            return createFieldCondition(FIELDS.ID);
        }

        public FieldCondition client() {
            return createFieldCondition(FIELDS.CLIENT);
        }

        public FieldCondition type() {
            return createFieldCondition(FIELDS.TYPE);
        }

        public FieldCondition parentId() {
            return createFieldCondition(FIELDS.PARENT_ID);
        }

        public FieldCondition name() {
            return createFieldCondition(FIELDS.NAME);
        }

        public FieldCondition i18nKey() {
            return createFieldCondition(FIELDS.I18N_KEY);
        }

        public FieldCondition icon() {
            return createFieldCondition(FIELDS.ICON);
        }

        public FieldCondition path() {
            return createFieldCondition(FIELDS.PATH);
        }

        public FieldCondition url() {
            return createFieldCondition(FIELDS.URL);
        }

        public FieldCondition sort() {
            return createFieldCondition(FIELDS.SORT);
        }

        public FieldCondition hideStatus() {
            return createFieldCondition(FIELDS.HIDE_STATUS);
        }

        public FieldCondition permission() {
            return createFieldCondition(FIELDS.PERMISSION);
        }

        public FieldCondition createTime() {
            return createFieldCondition(FIELDS.CREATE_TIME);
        }

        public FieldCondition createUser() {
            return createFieldCondition(FIELDS.CREATE_USER);
        }

        public FieldCondition lastModifyTime() {
            return createFieldCondition(FIELDS.LAST_MODIFY_TIME);
        }

        public FieldCondition lastModifyUser() {
            return createFieldCondition(FIELDS.LAST_MODIFY_USER);
        }
    }
}
